package test;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import ygFlower.domain.Flower;

/**
 * Created by IntelliJ IDEA.
 * User: li
 * Date: 2010-1-21
 * Time: 18:09:18
 * To change this template use File | Settings | File Templates.
 */
public class PersistByHibernate {
    public static void main(String[] args){
        Configuration config = new Configuration();
        config.configure();
        SessionFactory sf = config.buildSessionFactory();
        Session session = sf.openSession();

        Transaction tx = session.beginTransaction();

        tx.begin();
        Flower f = new Flower("f",20,12,"picture","tis is a flower");
        session.save(f);
        tx.commit();
        session.close();
    }
}
